package edu.spec.wyn.week09.class2.homework2;

import java.util.ArrayList;
import java.util.List;

public class Student {
    private String name;
    private int age;
    private int score;
    private  String classNum;

    public Student(String name, int age, int score, String classNum) {
        this.name = name;
        this.age = age;
        this.score = score;
        this.classNum = classNum;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

    public String getClassNum() {
        return classNum;
    }

    public void setClassNum(String classNum) {
        this.classNum = classNum;
    }

    public static void main(String[] args) {
        List l = new ArrayList();
        /*Student s1=new Student("Tom", 18, 100, "class05");
        Student s2=new Student("Jerry", 22, 70, "class04");
        Student s3=new Student("Owen", 25, 90, "class05");
        Student s4=new Student("Jim", 30,80 , "class05");
        Student s5=new Student("Steve", 28, 66, "class06");
        Student s6=new Student("Kevin", 24, 100, "class04");
        l.add(s1);
        l.add(s2);
        l.add(s3);
        l.add(s4);
        l.add(s5);
        l.add(s6);*/
        l.add(new Student("Tom ",8, 100, "class05"));  	//参数第一个表示姓名，第二个是年龄，第三个是分数，第4个是班级

            l.add(new Student("Jerry", 22, 70, "class04"));

            l.add(new Student("Owen", 25, 90, "class05"));

            l.add(new Student("Jim", 30,80 , "class05"));

            l.add(new Student("Steve", 28, 66, "class06"));

            l.add(new Student("Kevin", 24, 100, "class04"));

        int  totalAge=0;
        int  totalNum=0;
        for(int i=0;i<l.size();i++){
           Student s= (Student)l.get(i);
           totalAge +=s.age;
            /*if(s.classNum=="class06"){
                totalNum +=s.score;
            }*/
        }
        int avg=totalAge/l.size();
        System.out.println("平均年龄是："+avg);
       /* int ave=totalNum/l.size();
        System.out.println("平均分是:"+ave);*/

    }

}
